
// 渲染子表每一行的操作按钮

import TableRowOperator from '../../components/TableRowOperator';

import deepCopy from '../../../../public/functions/deep-copy';
import language from '../../language';

export default function(template, areaList) {

    let tmp = deepCopy(template);

    areaList.map((item) => {
        if(tmp[item].moduletype === 'table') {
            tmp[item].items.push({
                itemtype: 'customer',
                label: language['hi6007-000029'],/* 国际化处理： 操作*/
                visible: true,
                fixed: 'right',
                attrcode: 'operation',
                width: '200px',
                render: (text, record, index) => {
                    if(this.state.subTableEditable) {
                        return (
                            <TableRowOperator 
                                {...this.props}
                                index={index}
                                tableId={item}
                                copyRow={this.copyRow}
                                deleteRow={this.deleteRow}
                                pasteRow={this.pasteRow}
                                addRow={this.addRow}
                                insertRow={this.insertRow}
                            />
                        );
                    }
                }
            });
        }
    });

    return tmp;
}
